<template>
	<div class="mainWrapper abnormal Adjustment">
		<el-breadcrumb separator="/">
			<el-breadcrumb-item :to="{ path: '/' }"><i class="lh lh-diaodu fw_100"></i></el-breadcrumb-item>
			<el-breadcrumb-item>调度中心</el-breadcrumb-item>
			<el-breadcrumb-item>出勤监控</el-breadcrumb-item>
		</el-breadcrumb>

		<div class="content_Box box-shadow">
			<div class="pt_5 px_15">
				<el-form :inline="true" :model="ruleForm" class="form-inline" @keyup.enter.native="shearchBtn()">
					<el-form-item
						><el-input size="mini" class="w_140" v-model="task_sn" placeholder="任务编号"></el-input
					></el-form-item>
					<el-form-item
						><el-input size="mini" class="w_120" v-model="demand_sn" placeholder="订单编号"></el-input
					></el-form-item>
					<el-form-item
						><el-input size="mini" class="w_80" v-model="staff_name" placeholder="接单人"></el-input
					></el-form-item>
					<el-form-item
						><el-input size="mini" class="w_110" v-model="mobile" placeholder="手机号"></el-input
					></el-form-item>

					<el-form-item>
						<el-autocomplete
							size="mini"
							class="w_130"
							v-model="shop_name"
							:fetch-suggestions="querySearch"
							placeholder="店铺名称"
							:trigger-on-focus="true"
							@select="handleSelect"
						></el-autocomplete>
					</el-form-item>
					<lh-agent-list @sendValue="setValue" :reset="agent_reset"></lh-agent-list>
					<el-form-item>
						<el-select class="w_110" v-model="city_val" placeholder="请选择城市" @change="changeCity">
							<el-option
								v-for="item in cityList"
								:key="item.id"
								:label="item.name"
								:value="`${item.id}|${item.name}|${item.city_sn}`"
							></el-option>
						</el-select>
					</el-form-item>
					<el-form-item>
						<el-select v-model="s_time_slot" multiple collapse-tags placeholder="商圈" @change="changeBtndialogarea">
							<el-button
								size="mini"
								type="primary"
								class="round-right all-area"
								@click="selectAllArea()"
								native-type="button"
								>{{ areaStatus ? '全选' : '取消全选' }}</el-button
							>
							<el-option
								v-for="item in areaList"
								:key="item.id"
								:label="item.area_name"
								:value="`${item.id}|${item.area_name}`"
							></el-option>
						</el-select>
					</el-form-item>

					<el-form-item prop="date1">
						<el-date-picker
							size="mini"
							type="datetime"
							class="w_120i"
							value-format="yyyy-MM-dd HH:mm:ss"
							format="MM-dd HH:mm"
							placeholder="开始时间"
							v-model="ruleForm.date1"
						></el-date-picker> </el-form-item
					>~
					<el-form-item prop="date2">
						<el-date-picker
							size="mini"
							type="datetime"
							class="w_120i"
							value-format="yyyy-MM-dd HH:mm:ss"
							format="MM-dd HH:mm"
							placeholder="结束时间"
							v-model="ruleForm.date2"
						></el-date-picker>
					</el-form-item>

					<el-button size="mini" type="primary" class="round-right" @click="shearchBtn()" native-type="button"
						>搜索</el-button
					>
					<el-button size="mini" round @click="resetBtn">重置</el-button>
				</el-form>
			</div>
			<div class="pb_5 px_15 mb_5" id="dd-row-2">
				<el-row>
					<el-col :span="24">
						<el-button size="mini" class="fl" :type="status == 200 ? 'danger' : 'default'" @click="tagstate(200)"
							>超时未确认({{ statistic.abnormal_accept }})</el-button
						>
						<el-button size="mini" class="fl" :type="status == 100 ? 'danger' : 'default'" @click="tagstate(100)"
							>超时未签到({{ statistic.abnormal }})</el-button
						>
						<el-button size="mini" class="fl" :type="status == 300 ? 'danger' : 'default'" @click="tagstate(300)"
							>超时未签退({{ statistic.abnormal_finish }})</el-button
						>
						<el-button size="mini" class="fl" :type="status == 30 ? 'primary' : 'default'" @click="tagstate(30)"
							>待签到({{ statistic.accept }})</el-button
						>
						<el-button size="mini" class="fl" :type="status == 40 ? 'primary' : 'default'" @click="tagstate(40)"
							>进行中({{ statistic.checkin }})</el-button
						>
						<el-button size="mini" class="fl" :type="status == 70 ? 'warning' : 'default'" @click="tagstate(70)"
							>已取消({{ statistic.cancel }})</el-button
						>
						<el-button size="mini" class="fl" :type="status == 50 ? 'success' : 'default'" @click="tagstate(50)"
							>已完成({{ statistic.total }})</el-button
						>
						<el-button size="mini" class="fl" :type="status == 400 ? 'success' : 'default'" @click="tagstate(400)"
							>工时异常({{ statistic.abnormal_finish_diff }})</el-button
						>
					</el-col>
				</el-row>
			</div>

			<div class="tableMaxBox">
				<template>
					<el-table :data="demandList" stripe ref="multipleTable" :show-overflow-tooltip="false">
						<el-table-column prop="task_sn" label="任务编号" width="130px">
							<template slot-scope="{ row }">
								<span class="pointer u text-primary" @click="goToMore(row)">{{ row.task_sn }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="total" label="接单人" width="150">
							<template slot-scope="{ row }">
								<span class="text-success pointer" @click="toPersonnelListHx(row)"
									>{{ row.staff_name }} {{ row.mobile }}</span
								>
							</template>
						</el-table-column>
						<el-table-column prop="shop_name" label="店铺名称" width="170">
							<template slot-scope="{ row }">
								<el-tooltip effect="dark" placement="top" v-if="row.shop_remark != '' || row.shop_contact != ''">
									<div slot="content">
										<span class="">店铺负责人：{{ row.shop_contact }}&nbsp;&nbsp;{{ row.shop_contact_phone }}</span>
										<span class="tooltip">{{ row.shop_remark }}</span>
									</div>
									<div>
										<span
											v-if="row.shop_is_halal == 1"
											style="background: #c93a32; color: #fff; padding: 2px 3px; border-radius: 3px;"
											>清真</span
										>
										<span class="pointer u text-primary" @click="shopLists(row)">{{ row.shop_name }}</span>
									</div>
								</el-tooltip>
								<div v-if="row.shop_remark == '' && row.shop_contact == ''">
									<div>
										<span
											v-if="row.shop_is_halal == 1"
											style="background: #c93a32; color: #fff; padding: 2px 3px; border-radius: 3px;"
											>清真</span
										>
										<span class="pointer u text-primary" @click="shopLists(row)">{{ row.shop_name }}</span>
									</div>
								</div>
							</template>
						</el-table-column>
						<!-- <el-table-column prop="sn" label="订单编号" width="110">
							<template slot-scope="{ row }">
								<span class="pointer u text-primary" @click="goToMore(row)">{{ row.demand_sn }}</span>
							</template>
						</el-table-column> -->
						<el-table-column prop="area_name" label="商圈" width="110"></el-table-column>
						<el-table-column prop="label_name" label="岗位" width="90">
							<template slot-scope="{ row }">
								<!-- <span>{{ row.job_name }} {{ row.hour_expect }}h</span> -->
								<span>{{ row.job_name }}</span>
							</template>
						</el-table-column>
						<!-- <el-table-column prop="period" label="天数D" width="60" align="center"></el-table-column> -->
						<el-table-column prop="start_date" label="任务开始 ~ 结束时间" width="200px">
							<template slot-scope="{ row }">
								<span>{{ row.start_date }} {{ row.start_time }}~{{ row.end_time }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="task_description" width="200" label="要求"></el-table-column>
						<el-table-column prop="pay_status" width="100" label="支付状态">
							<template slot-scope="{ row }">
								<span class="text-success" v-if="row.pay_status == '未支付'">未支付</span>
								<span v-if="row.pay_status == '已支付'">已支付</span>
							</template>
						</el-table-column>
						<el-table-column prop="status" label="状态" width="60">
							<template slot-scope="{ row }">
								<span class="text-success" v-if="row.status == '10'">待分配</span>
								<span class="text-primary" v-if="row.status == '15'">待下发</span>
								<span class="text-primary" v-if="row.status == '20'">已下发</span>
								<span class="text-gray" v-if="row.status == '30'">已确认</span>
								<span class="text-warning" v-if="row.status == '40'">已签到</span>
								<span class="text-warning" v-if="row.status == '50' || row.status == '80'">已完成</span>
								<span class="text-default" v-if="row.status == '60'">已撤回</span>
								<span class="text-danger" v-if="row.status == '70'">已取消</span>
								<!-- <span class="text-success" v-if="row.status == '80'">已结算</span> -->
							</template>
						</el-table-column>
						<!-- 异常状态动态显示 -->
						<el-table-column prop="" label="异常状态" width="80">
							<template slot-scope="{ row }">
								<div>
									<div v-if="row.abnormal.length != 0">
										<div v-for="(item, index) in row.abnormal" :key="index">
											<span>{{ item }}</span>
										</div>
									</div>
									<div v-if="row.abnormal.length == 0"></div>
								</div>
							</template>
						</el-table-column>
						<!-- <el-table-column prop="hour_delay" label="延时T" min-width="60" align="center"></el-table-column> -->
						<el-table-column prop="hour_expect" label="计划时长" min-width="50" align="center">
							<template slot-scope="{ row }">
								<span>{{ row.hour_expect }}h</span>
							</template>
						</el-table-column>
						<el-table-column prop="hour_actual" label="实际时长" min-width="50" align="center">
							<!-- v-if="status == 50 || status == 400" -->
							<template slot-scope="{ row }">
								<span>{{ row.hour_actual }}h</span>
							</template>
						</el-table-column>
						<el-table-column prop="hour_diff" label="时长差(min)" min-width="90" align="center">
							<!-- v-if="status == 50 || status == 400" -->
							<template slot-scope="{ row }">
								<span>{{ row.hour_diff }}min</span>
							</template>
						</el-table-column>
						<el-table-column prop="shop_change_hour" label="店铺调整时长" min-width="60" align="center">
							<template slot-scope="{ row }">
								<span>{{ row.shop_change_hour }}h</span>
							</template>
						</el-table-column>
						<el-table-column prop="staff_change_hour" label="人才调整时长" min-width="60" align="center">
							<template slot-scope="{ row }">
								<span>{{ row.staff_change_hour }}h</span>
							</template>
						</el-table-column>
						<el-table-column label="操作" :width="status != 70 ? 170 : 50" fixed="right">
							<template slot-scope="{ row, $index }">
								<el-link
									:underline="false"
									type="danger"
									v-if="status != 50 && status != 70 && status != 400"
									@click="withdraw(row, $index)"
									>撤回</el-link
								>
								<el-link
									:underline="false"
									type="info"
									v-if="status != 50 && status != 70 && status != 400"
									@click="editBtn(row, $index)"
									>修改</el-link
								>
								<el-link
									:underline="false"
									type="danger"
									v-if="status != 50 && status != 70 && status != 400"
									@click="redactBtn(row, $index)"
									>取消</el-link
								>
								<el-link :underline="false" v-if="row.status == 20 || row.status == 30" @click="signIn(row, $index)"
									>签到</el-link
								>
								<el-link :underline="false" v-if="row.status == 40" @click="signOut(row, $index)">签退</el-link>
								<el-link
									:underline="false"
									type="primary"
									v-if="status == 50 || status == 400"
									@click="adjustBill(row, $index)"
								>
									调账
								</el-link>
							</template>
						</el-table-column>
					</el-table>
					<!-- 分页组件 -->
					<page :total="total" :pageNums="pageNum" @pagedata="onChildValue" class="mt_20"></page>
				</template>
			</div>
		</div>

		<!-- 任务取消-弹框 -->
		<el-dialog
			:title="diaTitle"
			:visible.sync="StateShowStop"
			width="560"
			:close-on-click-modal="false"
			@close="hiddenRY"
		>
			<div class="auditCentent">
				<div class="row-info clear">
					<div class="fl title-key"><i class="lhadmin lhadmin-wujiaoxing"></i><span>责任方：</span></div>
					<div class="fl list-cont">
						<el-select v-model="cancel.zrf" placeholder="请选择">
							<el-option v-for="(item, index) in all_revoke.cancel" :key="index" :label="item.name" :value="index">{{
								item.name
							}}</el-option>
						</el-select>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key"><i class="lhadmin lhadmin-wujiaoxing"></i><span>类型：</span></div>
					<div class="fl list-cont">
						<el-select v-model="cancel.type" placeholder="请选择">
							<el-option v-for="(item, index) in cancel_type" :key="index" :label="item.name" :value="index">{{
								item.name
							}}</el-option>
						</el-select>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key"><i class="lhadmin lhadmin-wujiaoxing"></i><span>原因：</span></div>
					<div class="fl list-cont">
						<el-select v-model="cancel.reason" placeholder="请选择">
							<el-option v-for="item in cancel_reason" :key="item.id" :label="item.title" :value="item.id"></el-option>
						</el-select>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key"><span>备注：</span></div>
					<div class="fl list-cont">
						<el-input type="textarea" :rows="8" :cols="44" placeholder="" v-model="cancel.bz"></el-input>
					</div>
				</div>
				<div style="color: #d9001b; margin-left: 100px;">
					注意：任务取消后会将任务金额原路退回给商户
				</div>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="addMenuBtn()">确 定</span>
				<span class="resetBtn" @click="hiddenRY">取 消</span>
			</div>
		</el-dialog>
		<!-- 任务撤销-弹框 -->
		<el-dialog
			:title="diaTitle"
			:visible.sync="StateShowcx"
			width="560"
			:close-on-click-modal="false"
			@close="hiddenRY"
		>
			<div class="auditCentent">
				<div class="row-info clear">
					<div class="fl title-key"><i class="lhadmin"></i><span>责任方：</span></div>
					<div class="fl list-cont">
						<el-select v-model="revoke.zrf" placeholder="请选择">
							<el-option v-for="(item, index) in all_revoke.withdraw" :key="index" :label="item.name" :value="index">{{
								item.name
							}}</el-option>
						</el-select>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key"><i class="lhadmin"></i><span>类型：</span></div>
					<div class="fl list-cont">
						<el-select v-model="revoke.type" placeholder="请选择">
							<el-option v-for="(item, index) in revoke_type" :key="index" :label="item.name" :value="index">{{
								item.name
							}}</el-option>
						</el-select>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key"><i class="lhadmin"></i><span>原因：</span></div>
					<div class="fl list-cont">
						<el-select v-model="revoke.reason" placeholder="请选择">
							<el-option v-for="item in revoke_reason" :key="item.id" :label="item.title" :value="item.id"></el-option>
						</el-select>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key"><i class="lhadmin"></i><span>备注：</span></div>
					<div class="fl list-cont">
						<el-input type="textarea" :rows="8" :cols="44" placeholder="" v-model="revoke.bz"></el-input>
					</div>
				</div>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="addCxBtn()">确 定</span>
				<span class="resetBtn" @click="hiddenRY">取 消</span>
			</div>
		</el-dialog>
		<!-- 修改任务-弹框 -->
		<el-dialog :title="diaTitle" :visible.sync="TaskEdit" width="600px" :close-on-click-modal="false">
			<div class="auditCentent">
				<div class="row-info clear">
					<div class="fl title-key">任务编号</div>
					<div class="fl list-cont bb">
						<el-input v-model="edit_task_sn" disabled></el-input>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">任务开始</div>
					<div class="fl list-cont bb">
						<el-input v-model="edit_time1" disabled></el-input>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">结束时间</div>
					<div class="fl list-cont bb">
						<el-input v-model="edit_time2" disabled></el-input>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">计划时长</div>
					<div class="fl list-cont b_sj">
						<el-input v-model="edit_date" placeholder disabled></el-input>
					</div>
					<div class="fl title-key" style="width: 50px; text-align: left; margin-left: 10px;">h</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">签到时间</div>
					<div class="fl list-cont bb">
						<el-date-picker
							v-model="edit_checkin_time"
							type="datetime"
							value-format="yyyy-MM-dd HH:mm:ss"
							placeholder=""
							:disabled="edit_static == 20 || edit_static == 30"
							@change="edit_checkin_time_change()"
						></el-date-picker>
					</div>
				</div>
				<!-- <div class="row-info clear">
					<div class="fl title-key">延时时长</div>

					<div class="fl list-cont b_sj">
						<el-input
							v-model="edit_hour_delay"
							placeholder
							:disabled="this.edit_static == 50 ? true : false"
						></el-input>
					</div>
					<div class="fl title-key" style="width: 50px; text-align: left; margin-left: 10px;">h</div>
				</div> -->
				<div class="row-info clear">
					<div class="fl title-key">完成时间</div>
					<div class="fl list-cont bb">
						<el-date-picker
							v-model="edit_finish_time"
							type="datetime"
							value-format="yyyy-MM-dd HH:mm:ss"
							placeholder=""
							:disabled="this.edit_static == 50 ? false : true"
							@change="edit_finish_time_change()"
						></el-date-picker>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">实际时长</div>

					<div class="fl list-cont b_sj">
						<el-input v-model="edit_hour_actual" placeholder disabled></el-input>
					</div>
					<div class="fl title-key" style="width: 50px; text-align: left; margin-left: 10px;">h</div>
				</div>
				<div class="row-info clear">
					<!--					<div class="fl title-key">价格</div>-->
					<!--					<div class="fl list-cont b_sj">-->
					<!--						<el-input v-model="amout_shop" placeholder></el-input>-->
					<!--					</div>-->
					<!--					<div class="fl title-key" style="width: 50px; text-align: left; margin-left: 10px;">元/小时</div>-->
				</div>
				<div class="row-info clear" v-if="edit_static2 != 50">
					<div class="fl title-key">状态</div>

					<div class="fl list-cont b">
						<!-- 待分配 -->
						<el-select v-model="edit_static" v-if="edit_static2 == 10" placeholder="请选择" @change="abelEadit">
							<el-option label="待分配" value="10">待分配</el-option>
							<!-- <el-option label="已完成" value="50">已完成</el-option> -->
						</el-select>
						<!-- 已分配 -->
						<el-select v-model="edit_static" v-if="edit_static2 == 20" placeholder="请选择" @change="abelEadit">
							<el-option label="已分配" value="20">已分配</el-option>
							<!-- <el-option label="已完成" value="50">已完成</el-option> -->
						</el-select>
						<!-- 已确认 -->
						<el-select v-model="edit_static" v-if="edit_static2 == 30" placeholder="请选择" @change="abelEadit">
							<el-option label="已确认" value="30">已确认</el-option>
							<el-option label="已签到" value="40">已签到</el-option>
							<!-- <el-option label="已完成" value="50">已完成</el-option> -->
						</el-select>
						<!-- 已签到 -->
						<el-select v-model="edit_static" v-if="edit_static2 == 40" placeholder="请选择" @change="abelEadit">
							<el-option label="已签到" value="40">已签到</el-option>
							<!-- <el-option label="已完成" value="50">已完成</el-option> -->
						</el-select>
						<!-- 已完成 -->
						<!-- <el-select v-model="edit_static" v-if="edit_static2 == 50" placeholder="请选择">
							<el-option label="已完成" value="50">已完成</el-option>
						</el-select> -->
						<!-- 已撤回 -->
						<el-select v-model="edit_static" v-if="edit_static2 == 60" placeholder="请选择" @change="abelEadit">
							<el-option label="已撤回" value="60">已撤回</el-option>
							<!-- <el-option label="已完成" value="50">已完成</el-option> -->
						</el-select>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">备注</div>
					<div class="fl list-cont b_sj">
						<el-input type="textarea" :rows="6" :cols="30" placeholder="" v-model="update_remark"></el-input>
					</div>
				</div>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="taskBtnEdit()">确 定</span>
				<span class="resetBtn" @click="hiddenRY">取 消</span>
			</div>
		</el-dialog>
		<!-- 手动签到-弹框 -->
		<el-dialog
			:title="diaTitle"
			:visible.sync="TaskSignIn"
			width="600px"
			:close-on-click-modal="false"
			@close="closeTaskSignIn"
		>
			<div class="auditCentent">
				<div class="row-info clear">
					<div class="fl title-key">任务编号</div>
					<div class="fl list-cont bb">
						<el-input v-model="edit_task_sn" disabled></el-input>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">任务开始</div>
					<div class="fl list-cont bb">
						<el-input v-model="edit_time1" disabled></el-input>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">结束时间</div>
					<div class="fl list-cont bb">
						<el-input v-model="edit_time2" disabled></el-input>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">计划时长</div>
					<div class="fl list-cont b_sj">
						<el-input v-model="edit_date" placeholder disabled></el-input>
					</div>
					<div class="fl title-key" style="width: 50px; text-align: left; margin-left: 10px;">h</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">签到时间</div>
					<div class="fl list-cont bb">
						<el-date-picker
							v-model="manual_checkin_time"
							type="datetime"
							value-format="yyyy-MM-dd HH:mm:ss"
							placeholder=""
							:default-value="edit_time1"
							:picker-options="{
								disabledDate: time => {
									return time.getTime() > new Date(edit_time2)
								},
								selectableRange: range_time1
							}"
						></el-date-picker>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">备注</div>
					<div class="fl list-cont b_sj">
						<el-input type="textarea" :rows="6" :cols="30" placeholder="" v-model="manual_remark"></el-input>
					</div>
				</div>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="taskBtnManual()">确 定</span>
				<span class="resetBtn" @click="hiddenRY">取 消</span>
			</div>
		</el-dialog>

		<!-- 手动签退-弹框 -->
		<el-dialog
			:title="diaTitle"
			:visible.sync="taskSignOutDialog"
			width="600px"
			:close-on-click-modal="false"
			@close="closeSignOutDialog"
		>
			<div class="auditCentent">
				<div class="row-info clear">
					<div class="fl title-key">任务编号</div>
					<div class="fl list-cont bb">
						<el-input v-model="edit_task_sn" disabled></el-input>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">任务开始</div>
					<div class="fl list-cont bb">
						<el-input v-model="edit_time1" disabled></el-input>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">结束时间</div>
					<div class="fl list-cont bb">
						<el-input v-model="edit_time2" disabled></el-input>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">签到时间</div>
					<div class="fl list-cont bb">
						<el-input v-model="manual_checkin_time" disabled></el-input>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">计划时长</div>
					<div class="fl list-cont b_sj">
						<el-input v-model="edit_date" placeholder disabled></el-input>
					</div>
					<div class="fl title-key" style="width: 50px; text-align: left; margin-left: 10px;">h</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">签退时间</div>
					<div class="fl list-cont bb">
						<el-date-picker
							v-model="finish_time"
							type="datetime"
							value-format="yyyy-MM-dd HH:mm:ss"
							placeholder=""
							:default-value="edit_time2"
							:picker-options="{
								disabledDate: time => {
									return time.getTime() < new Date(edit_time1) - 8.64e7
								},
								selectableRange: range_time2
							}"
						></el-date-picker>
					</div>
				</div>
				<div class="row-info clear">
					<div class="fl title-key">备注</div>
					<div class="fl list-cont b_sj">
						<el-input type="textarea" :rows="6" :cols="30" placeholder="" v-model="sign_out_description"></el-input>
					</div>
				</div>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="taskBtnManualSignOut()">确 定</span>
				<span class="resetBtn" @click="hiddenRY">取 消</span>
			</div>
		</el-dialog>
		<!-- 创建调账记录-弹框 -->
		<el-dialog
			title="创建调账记录"
			:visible.sync="JobState"
			width="940px"
			:close-on-click-modal="false"
			:before-close="hiddenRY"
		>
			<div class="auditCentent tz">
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">任务编号</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.task_sn"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">店铺名称</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.dpmc"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">商圈</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.sq"></el-input>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">岗位</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.gw"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">工作时间</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.gzsj"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">单价</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.dj"></el-input>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">接单人</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.jdr"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">实际时长</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.sjsc"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">费用</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.fy"></el-input>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">签到时间</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.qdsj"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">完成时间</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.wcsj"></el-input>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">状态</div>
						<div class="fl list-cont bb">
							<el-input size="mini" disabled v-model="adjustment.zt"></el-input>
						</div>
					</div>
				</div>
				<!-- 历史调账记录 -->
				<el-table :data="recordsList" style="width: 100%;">
					<el-table-column prop="adjust_type" label="调账对象" align="center">
						<template slot-scope="{ row }">
							<span class="text-success" v-if="row.adjust_type == 'staff'">人才</span>
							<span class="text-info" v-if="row.adjust_type == 'shop'">店铺</span>
						</template>
					</el-table-column>
					<el-table-column prop="adjust_hours" label="调整时长" align="center">
						<template slot-scope="{ row }">
							<span>{{ row.adjust_hours }}h</span>
						</template>
					</el-table-column>
					<el-table-column prop="amount_other" label="其他金额" align="center"> </el-table-column>
					<el-table-column prop="adjust_amount" label="合计金额" align="center"> </el-table-column>
					<el-table-column prop="remark" label="备注" align="center"> </el-table-column>
					<el-table-column prop="status" label="状态" width="80" align="center">
						<template slot-scope="{ row }">
							<span class="text-light" v-if="row.status == 10">未入账单</span>
							<span class="text-primary" v-if="row.status == 20">已入账单</span>
							<span class="text-danger" v-if="row.status == 30">已作废</span>
							<span class="text-info" v-if="row.status == 40 && row.adjust_type == 'shop'">待支付</span>
							<span class="text-success" v-if="row.status == 50 && row.adjust_type == 'shop'">已支付</span>
							<span class="text-info" v-if="row.status == 40 && row.adjust_type == 'staff'">待提现</span>
							<span class="text-success" v-if="row.status == 50 && row.adjust_type == 'staff'">已提现</span>
							<span class="text-danger" v-if="row.status == 60">已退款</span>
						</template>
					</el-table-column>
					<el-table-column prop="adder" label="创建人" align="center"> </el-table-column>
					<el-table-column prop="add_time" label="创建时间" align="center" width="160"> </el-table-column>
				</el-table>
				<el-divider v-if="adjustment.dj">对店铺{{ adjustment.dj }} 元/小时</el-divider>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">时长</div>
						<div class="fl list-cont shichang">
							<el-select v-model="adjustment.sc">
								<el-option label="加" value="1"></el-option>
								<el-option label="减" value="2"></el-option>
							</el-select>
							<el-input
								size="mini"
								v-model="adjustment.sc_next"
								onKeyPress="if((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46 || /\.\d\d$/.test(value))event.returnValue=false"
							></el-input>
							<div style="margin: 0 22px 0 0;">h</div>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">时长金额</div>
						<div class="fl list-cont shichang_next">
							<el-input size="mini" v-model="adjustment.scje" disabled></el-input>
							<div style="margin: 0 22px 0 0;">元</div>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">其他金额</div>
						<div class="fl list-cont shichang">
							<el-select v-model="adjustment.qtje">
								<el-option label="加" value="1"></el-option>
								<el-option label="减" value="2"></el-option>
							</el-select>
							<el-input size="mini" v-model="adjustment.qtje_next"></el-input>
							<div style="margin: 0 16px 0 0;">元</div>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">合计金额</div>
						<div class="fl list-cont shichang_next">
							<el-input size="mini" v-model="adjustment.hjje" disabled></el-input>
							<div style="margin: 0 22px 0 0;">元</div>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key"><i class="lhadmin lhadmin-wujiaoxing"></i>备注</div>
						<div class="fl list-cont shichang">
							<el-input type="textarea" :rows="8" :cols="44" placeholder="请填写" v-model="adjustment.bz"></el-input>
						</div>
					</div>
				</div>
				<el-divider v-if="adjustment.personnel_dj">对人才{{ adjustment.personnel_dj }} 元/小时</el-divider>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">时长</div>
						<div class="fl list-cont shichang">
							<el-select v-model="adjustment.personnel_sc">
								<el-option label="加" value="1"></el-option>
								<el-option label="减" value="2"></el-option>
							</el-select>
							<el-input
								size="mini"
								v-model="adjustment.personnel_sc_next"
								onKeyPress="if((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46 || /\.\d\d$/.test(value))event.returnValue=false"
							></el-input>
							<div style="margin: 0 22px 0 0;">h</div>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">时长金额</div>
						<div class="fl list-cont shichang_next">
							<el-input size="mini" v-model="adjustment.personnel_scje" disabled></el-input>
							<div style="margin: 0 22px 0 0;">元</div>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key">其他金额</div>
						<div class="fl list-cont shichang">
							<el-select v-model="adjustment.personnel_qtje">
								<el-option label="加" value="1"></el-option>
								<el-option label="减" value="2"></el-option>
							</el-select>
							<el-input size="mini" v-model="adjustment.personnel_qtje_next"></el-input>
							<div style="margin: 0 16px 0 0;">元</div>
						</div>
					</div>
					<div class="row-info clear">
						<div class="fl title-key">合计金额</div>
						<div class="fl list-cont shichang_next">
							<el-input size="mini" v-model="adjustment.personnel_hjje" disabled></el-input>
							<div style="margin: 0 22px 0 0;">元</div>
						</div>
					</div>
				</div>
				<div class="auditCentent_next">
					<div class="row-info clear">
						<div class="fl title-key"><i class="lhadmin lhadmin-wujiaoxing"></i>备注</div>
						<div class="fl list-cont shichang">
							<el-input
								type="textarea"
								:rows="8"
								:cols="44"
								placeholder="请填写"
								v-model="adjustment.personnel_bz"
							></el-input>
						</div>
					</div>
				</div>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="ticketMesaudit()">保 存</span>
				<span class="resetBtn" @click="hiddenRY()">关 闭</span>
			</div>
		</el-dialog>
		<!-- 该任务已有调账记录，确认还要创建吗? -->
		<el-dialog title="创建提示" :visible.sync="AssignmentTips" width="560px" :close-on-click-modal="false">
			<div class="auditCentent">
				<span>该任务已有调账记录，确认还要创建吗?</span>
			</div>
			<div slot="footer" class="dialog-footer">
				<span class="btnOK mr_20" @click="ticketMesaudit(2)">确 定</span>
				<span class="resetBtn" @click="AssignmentTips = false">取 消</span>
			</div>
		</el-dialog>
	</div>
</template>

<script>
var common = require('../../../static/tool.js')
import { mainfun } from '../../../assets/js/main.js'
import { publicData } from '../../../assets/js/data.js'

import {
	taskInfo,
	queryStatistics,
	fetchReasonList,
	taskCancel,
	taskWithdraw,
	taskCheckin,
	taskSave,
	taskCheckOut
} from '@/api/task.js'
import { billCreate, billList } from '@/api/bill'
import { fetchShopList, fetchAreaList } from '@/api/shop.js'
import { fetchCityList } from '@/api/city.js'

export default {
	name: 'TaskAttendances',
	data() {
		return {
			id: '',
			dataMes: '',
			ids: '',
			sn: '',
			index: '200',
			windowSizeHeight: document.documentElement.clientHeight, //浏览器可视化窗口的大小
			screenHeight: document.documentElement.clientHeight,
			manageInfo: JSON.parse(sessionStorage.getItem('manageInfo')), //登录信息
			url: common.url,
			head_url: common.head_url,
			//搜索对应值
			task_sn: '', //任务编号
			demand_sn: '', //订单编号
			staff_sn: '', // 接单人编号
			staff_name: '', //接单人
			mobile: '', //手机号
			agent_id: '',
			area_arr: '', //商圈信息
			area_id: '',
			area_name: '',
			cityList: [], // 城市列表
			city_val: '',
			city_id: '',
			s_time_slot: '',
			s_departmentIds: [],
			s_departmentNames: [],
			type_arr: '', //需求信息
			label_id: '',
			label_name: '',
			shop_id: '', //店铺id
			shop_name: '', //店铺名
			next_shop_sn: '', //店铺sn
			status: '200',
			time_type: '2', //时间类型选择
			ruleForm: {
				date1: '', //开始时间
				date2: '' //结束时间
			},

			demandList: [], //任务列表
			centerLists: [], //全景调度列表
			statistic: {
				abnormal: '', //异常
				abnormal_accept: '', //超时未确认
				abnormal_finish: '', //超时未签退
				accept: '', //待签到
				checkin: '', //进行中
				cancel: '', //已取消
				finish: '', //已完成
				total: '',
				abnormal_finish_diff: '' //工时异常
			}, //任务统计条数
			//向分页组件传值
			total: 0,
			pageNum: '',
			pageSizeNow: '',
			// 审核状态
			text: '',
			areaList: [], //区域列表
			shopList: [], //店铺列表
			diaTitle: '', //弹框title
			StateShowStop: false,
			StateShowcx: false,
			TaskEdit: false,
			TaskSignIn: false,
			taskSignOutDialog: false, // 手动签退弹框
			JobState: false,
			AssignmentTips: false,
			//历史调账记录
			recordsList: [],
			//任务修改
			actual_end_time: '', //计费完成时间
			edit_task_sn: '',
			edit_time1: '',
			edit_time2: '',
			edit_date: '',
			edit_checkin_time: '',
			actual_start_time: '', //计费开始时间
			actual_start_time2: '',
			edit_hour_delay: '',
			edit_finish_time: '',
			edit_finish_time2: '',
			edit_hour_actual: '',
			edit_price: '',
			edit_static: '',
			edit_static2: '', //任务详情的值
			amout_shop: '',
			update_remark: '',
			//手动签到
			manual_checkin_time: '',
			manual_remark: '', //签到备注
			manual_task_remark: '', //任务备注
			finish_time: '', //签退时间
			sign_out_description: '', // 签退备注

			all_revoke: [],
			//撤销相关
			revoke: {
				zrf: '',
				type: '',
				reason: '',
				bz: ''
			},
			revoke_type: [], //撤销类型列表
			revoke_reason: [], //撤销原因列表

			//取消相关
			cancel: {
				zrf: '',
				type: '',
				reason: '',
				bz: ''
			},
			cancel_type: [], //取消类型列表
			cancel_reason: [], //取消原因列表
			range_time2: '',
			range_time1: '',
			//创建调账记录的值
			adjustment: {
				adjustment_sn: '', //调账记录编号
				task_sn: '', //任务编号
				dpmc: '', //店铺名称
				sq: '', //商圈
				gw: '', //岗位
				gzsj: '', //工作时间
				dj: '', //店铺单价
				personnel_dj: '', //人才单价
				jdr: '', //接单人
				sjsc: '', //实际时长
				fy: '', //费用
				qdsj: '', //签到时间
				wcsj: '', //完成时间
				zt: '', //状态
				//对店铺
				sc: '1', //时长
				sc_next: '0',
				scje: '0', //时长金额
				qtje: '1', //其他金额
				qtje_next: '0',
				hjje: '0', //合计金额
				bz: '', //备注
				//对人才
				personnel_sc: '1', //时长
				personnel_sc_next: '0',
				personnel_scje: '0', //时长金额
				personnel_qtje: '1', //其他金额
				personnel_qtje_next: '0',
				personnel_hjje: '0', //合计金额
				personnel_bz: '', //备注
				areaStatus: true,
				is_prepay: '', //是否预付
				invoice_status: '' //发票状态
			},
			areaStatus: true,
			agent_reset: 0
		}
	},
	computed: {
		//撤销相关
		poke_zrf() {
			return this.revoke.zrf.toString()
		},
		//撤销相关
		poke_type() {
			return this.revoke.type.toString()
		},
		//取消相关
		cancels_zrf() {
			return this.cancel.zrf.toString()
		},
		//取消相关
		cancels_type() {
			return this.cancel.type.toString()
		},
		// 手动签到时间
		checkin_time() {
			return this.manual_checkin_time
		},
		// 手动签退
		checkOut_time() {
			return this.finish_time
		},
		//===对店铺===
		//时长金额计算
		scje() {
			if (this.adjustment.sc == 1) {
				return (this.adjustment.sc_next * this.adjustment.dj).toFixed(2)
			}

			return (this.adjustment.sc_next * this.adjustment.dj * -1).toFixed(2)
		},
		//合计金额计算
		hjje() {
			if (this.adjustment.qtje == 1) {
				return (Number(this.adjustment.qtje_next * 1) + Number(this.adjustment.scje) * 1).toFixed(2)
			} else {
				return (Number(this.adjustment.qtje_next * -1) + Number(this.adjustment.scje) * 1).toFixed(2)
			}
		},

		//===对人才===
		//时长金额计算
		personnel_scje() {
			if (this.adjustment.personnel_sc == 1) {
				return (this.adjustment.personnel_sc_next * this.adjustment.personnel_dj).toFixed(2)
			}

			return (this.adjustment.personnel_sc_next * this.adjustment.personnel_dj * -1).toFixed(2)
		},
		//合计金额计算
		personnel_hjje() {
			if (this.adjustment.personnel_qtje == 1) {
				return (Number(this.adjustment.personnel_qtje_next * 1) + Number(this.adjustment.personnel_scje) * 1).toFixed(2)
			} else {
				return (Number(this.adjustment.personnel_qtje_next * -1) + Number(this.adjustment.personnel_scje) * 1).toFixed(
					2
				)
			}
		},
		city_value() {
			return this.city_val
		}
	},
	watch: {
		//撤销-责任方改变
		poke_zrf(newValue, oldValue) {
			if (newValue != '') {
				this.revoke.type = '' //类型清空
				this.revoke.reason = '' //原因清空
				this.revoke_type = [] //撤销类型列表清空
				this.revoke_reason = [] //撤销原因列表清空
				this.revoke_type = this.all_revoke.withdraw[newValue].child
			} else {
				this.revoke.type = '' //类型清空
				this.revoke.reason = '' //原因清空
				this.revoke_type = [] //撤销类型列表清空
				this.revoke_reason = [] //撤销原因列表清空
				this.revoke_type = []
			}
		},
		//撤销-类型改变
		poke_type(newValue, oldValue) {
			if (newValue != '') {
				this.revoke.reason = '' //原因清空
				this.revoke_reason = this.revoke_type[newValue].child
			} else {
				this.revoke.reason = '' //原因清空
				this.revoke_reason = []
			}
		},
		//取消-责任方改变
		cancels_zrf(newValue, oldValue) {
			if (newValue != '') {
				this.cancel.type = '' //类型清空
				this.cancel.reason = '' //原因清空
				this.cancel_type = [] //取消类型列表清空
				this.cancel_reason = [] //取消原因列表清空
				this.cancel_type = this.all_revoke.cancel[newValue].child
			} else {
				this.cancel.type = '' //类型清空
				this.cancel.reason = '' //原因清空
				this.cancel_type = [] //取消类型列表清空
				this.cancel_reason = [] //取消原因列表清空
				this.cancel_type = []
			}
		},
		//取消-类型改变
		cancels_type(newValue, oldValue) {
			if (newValue != '') {
				this.cancel.reason = '' //原因清空
				this.cancel_reason = this.cancel_type[newValue].child
			} else {
				this.cancel.reason = '' //原因清空
				this.cancel_reason = []
			}
		},
		//===对店铺===
		scje(newValue, oldValue) {
			if (!isNaN(newValue)) {
				this.adjustment.scje = newValue
			} else {
				this.adjustment.scje = 0
			}
		},
		hjje(newValue, oldValue) {
			if (!isNaN(newValue)) {
				this.adjustment.hjje = newValue
			} else {
				this.adjustment.hjje = 0
			}
		},
		//===对人才===
		personnel_scje(newValue, oldValue) {
			if (!isNaN(newValue)) {
				this.adjustment.personnel_scje = newValue
			} else {
				this.adjustment.personnel_scje = 0
			}
		},
		personnel_hjje(newValue, oldValue) {
			if (!isNaN(newValue)) {
				this.adjustment.personnel_hjje = newValue
			} else {
				this.adjustment.personnel_hjje = 0
			}
		},
		//商圈改变
		areaList(newValue, oldValue) {
			this.listShop()
		},
		// 手动签到弹框--签到时间值
		checkin_time(newValue) {
			if (newValue) {
				this.manual_checkin_time = newValue
				let moment1 = this.$moment(this.manual_checkin_time.substring(0, 10))
				let moment2 = this.$moment(this.edit_time2.substring(0, 10))
				if (moment1.isSame(moment2)) {
					this.range_time1 = '00:00:00' + '-' + this.edit_time2.substring(11)
					// this.manual_checkin_time = this.edit_time2
				} else {
					this.range_time1 = '00:00:00' + '-' + '23:59:59'
					// this.manual_checkin_time = this.edit_time2
				}
			}
		},
		// 手动签退弹框--签退时间值
		checkOut_time(newValue) {
			if (newValue) {
				this.finish_time = newValue
				if (new Date(this.finish_time) < new Date(this.edit_time1)) {
					this.range_time2 = this.edit_time1.substring(11) + '-' + '23:59:59'
					this.finish_time = this.edit_time1
				}
			}
		}
	},
	created() {
		this.selectedAreasMap = {}
		// this.fetchCityList()
		//获取商圈列表
		// this.getAreaList()
		//取消和撤销原因接口
		this.reasonList()

		if (this.$route.query.id) {
			this.id = this.$route.query.id //接收传参
			this.business_id = this.id
		}
		if (!sessionStorage.getItem('manageInfo')) {
			// 判断是否登录
			window.location = 'login.html'
			return
		}

		this.ruleForm.date1 = this.date(0) + ' 00:00:00'
		this.ruleForm.date2 = this.date(0) + ' 23:59:00'

		// 全景调度列表，默认选中时间和商圈
		this.next_date = this.date(0)
	},
	mounted() {
		//判断是否默认设置商圈
		// if (localStorage.getItem('attendances_area') && localStorage.getItem('attendances_area') != '') {
		// 	this.s_time_slot = localStorage.getItem('attendances_area').split(',')
		// }
	},
	methods: {
		date(e) {
			return this.$moment().add('days', e).format('YYYY-MM-DD')
		},
		date_now(e) {
			var date = new Date()
			var seperator1 = '-'
			var seperator2 = ':'
			var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
			var strDate = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
			var currentdate =
				date.getFullYear() +
				seperator1 +
				month +
				seperator1 +
				strDate +
				' ' +
				date.getHours() +
				seperator2 +
				date.getMinutes() +
				seperator2 +
				date.getSeconds()
			return currentdate
		},
		time_dis(a, b) {
			// direct_time格式为yyyy-mm-dd hh:mm:ss 指定时间
			var now_time = Date.parse(new Date(a)) //指定时间的时间戳
			var end_time = Date.parse(new Date(b)) //指定时间的时间戳
			if (end_time < now_time) {
				console.log('时间差值0分钟')
				return 0
			} else {
				var time_dis = end_time - now_time
				var minutes = Math.floor(time_dis / (60 * 1000))
				console.log('时间差值' + minutes + '分钟')
				return minutes
			}
		},
		// 监听城市val变化
		async changeCity() {
			let [id, name, city_sn] = this.city_val.split('|') // es6 数组解构赋值
			this.city_id = id
			this.city_name = name
			this.city_sn = city_sn
			await this.getshopList()
			await this.getAreaList(this.city_id) //商圈列表
		},

		//取消和撤销原因接口
		async reasonList() {
			try {
				let ret = await fetchReasonList()
				this.all_revoke = ret
			} catch (error) {
				console.log('error:', error)
			}
		},

		// 获取店铺列表
		async getshopList() {
			try {
				let ret = await fetchShopList({
					sign_status: 30,
					status: 1,
					city_id: this.city_id,
					agent_id: this.agent_id
				})
				this.shop_id = ''
				this.shop_name = ''
				this.shop_sn = ''
				ret.list.forEach(item => {
					item.value = item.name
				})
				this.shopList = ret.list
			} catch (error) {
				console.log('error:', error)
			}
		},

		listShop() {
			//判断时间框是否存在值
			if (this.ruleForm.date1 == null || this.ruleForm.date1 == '') {
				this.$message.error('请选择任务开始时间！')
				return
			}
			if (this.ruleForm.date2 == null || this.ruleForm.date2 == '') {
				this.$message.error('请选择任务结束时间！')
				return
			}

			//获取任务列表
			let fn = new FormData()
			fn.append('pageSize', this.pageSizeNow) //每页多少条
			fn.append('page', this.pageNum) //页数
			fn.append('task_sn', this.task_sn)
			fn.append('demand_sn', this.demand_sn)
			fn.append('staff_name', this.staff_name)
			fn.append('mobile', this.mobile)
			fn.append('city_id', this.city_id)
			fn.append('agent_id', this.agent_id)
			if (this.shop_name == '') {
				this.shop_id = ''
			}
			fn.append('shop_id', this.shop_id)
			// 多选操作，多个id
			// if (this.s_time_slot.length == 0) {
			// 	this.$message.error('请选择商圈！')
			// 	return
			// }
			var s_departmentIds_Arr = new Array()
			this.s_time_slot.forEach(element => {
				let [id, name] = element.split('|') // es6 数组解构赋值
				s_departmentIds_Arr.push(id.toString())
			})
			fn.append('area_id', s_departmentIds_Arr.toString())
			fn.append('label_id', this.label_id)
			//排序使用
			var order_obj = {
				shop_id: 1,
				start_time: 1
			}
			let status
			if (this.status == 100) {
				//超时未签到
				fn.append('status', '30')
				fn.append('abnormal_status', '11')
				order_obj = {
					start_time: 1
				}
			} else if (this.status == 200) {
				//超时未确认
				fn.append('status', '20')
				fn.append('abnormal_status', '10')
			} else if (this.status == 300) {
				// 超时未签退
				fn.append('status', '40')
				fn.append('abnormal_status', '13')
			} else if (this.status == 30) {
				//待签到
				fn.append('status', this.status)
				order_obj = {
					start_time: 1
				}
			} else if (this.status == 50) {
				status = this.status + ',' + '80'
				fn.append('status', status)
			} else if (this.status == 400) {
				// 工时异常
				fn.append('status', '50,80')
				fn.append('abnormal_status', '14')
				order_obj = {
					hour_diff: -1,
					shop_id: 1,
					start_time: 1
				}
			} else {
				fn.append('status', this.status)
			}

			fn.append('time_type', this.time_type)
			if (this.ruleForm.date1 == null) {
				this.ruleForm.date1 = ''
			}
			fn.append('start_time', this.ruleForm.date1)
			if (this.ruleForm.date2 == null) {
				this.ruleForm.date2 = ''
			}
			fn.append('end_time', this.ruleForm.date2)

			fn.append('order', JSON.stringify(order_obj))
			//鼠标移动-显示店铺信息
			fn.append('source', 'dispatch')
			fn.append('flow_path', 1)
			this.$http.post(this.url + '/task/attendance', fn).then(
				res => {
					if (res.data.msg == '查询成功！' || res.data.code == '200') {
						if (res.data.data != null) {
							var demandList = res.data.data.list
							this.demandList = demandList
							this.total = res.data.data.count
							//当前选中状态的数量赋值
							//任务统计条数
							this.statistics_sum()
						} else {
							this.demandList = []
							this.total = 0
						}
					} else if (res.data.code == '8886') {
						//code   8886  登录过期
						sessionStorage.clear()
						this.$alert('登录已过期，请重新登录 !', '提示', {
							confirmButtonText: '确定',
							callback: action => {
								window.location = 'login.html'
							}
						})
						return
					} else {
						this.$message.error(res.data.msg)
						return
					}
				},
				res => {
					this.$message.error('网络错误！')
					return
				}
			)
		},
		shearchBtn() {
			this.listShop() //上面列表数据
		},

		async resetBtn() {
			//重置
			await this.resetData() //重置请求数据
			this.pageNum = 1
			// this.listShop()
			this.agent_reset += 1
		},

		resetData() {
			//重置请求数据
			this.pageNum = 1
			this.task_sn = ''
			this.demand_sn = ''
			this.staff_name = ''
			this.mobile = ''
			this.type_arr = ''
			this.label_id = ''
			this.label_name = ''
			this.business_id = ''
			this.business_name = ''
			this.shop_id = ''
			this.shop_name = ''
			this.status = '200'
			this.ruleForm.date1 = this.date(0) + ' 00:00:00'
			this.ruleForm.date2 = this.date(0) + ' 23:59:00'
			this.index = '200'
		},
		//在异常列表与任务列表数据获取之后
		async statistics_sum() {
			// 多选操作，多个id
			// if (this.s_time_slot.length == 0) {
			// 	this.$message.error('请选择商圈！')
			// 	return
			// }
			var s_departmentIds_Arr = new Array()
			this.s_time_slot.forEach(element => {
				let [id, name] = element.split('|') // es6 数组解构赋值
				s_departmentIds_Arr.push(id.toString())
			})
			try {
				let ret = await queryStatistics({
					task_sn: this.task_sn,
					demand_sn: this.demand_sn,
					staff_name: this.staff_name,
					mobile: this.mobile,
					shop_id: this.shop_id,
					city_id: this.city_id,
					area_id: s_departmentIds_Arr.toString(),
					agent_id: this.agent_id,
					label_id: this.label_id,
					time_type: this.time_type,
					start_time: this.ruleForm.date1,
					end_time: this.ruleForm.date2,
					flow_path: 1
				})
				if (ret) {
					this.statistic.abnormal = ret.abnormal_checkin //超时未签到
					this.statistic.abnormal_accept = ret.abnormal_accept //超时未确认
					this.statistic.abnormal_finish = ret.abnormal_finish // 超时未签退
					this.statistic.accept = ret.accept //待签到
					this.statistic.checkin = ret.checkin //进行中
					this.statistic.cancel = ret.cancel //已取消
					this.statistic.finish = ret.finish //已完成
					this.statistic.total = ret.finish + ret.settlement //已完成已取消之和
					this.statistic.abnormal_finish_diff = ret.abnormal_finish_diff //工时异常
				}
			} catch (error) {
				console.log('error:', error)
			}
		},

		//跳转店铺列表
		shopLists(row) {
			const { href } = this.$router.resolve({
				path: '/shopList',
				query: { shop_name: row.shop_name, shop_id: row.shop_id }
			})
			window.open(href, '_blank')
		},

		// 跳转任务详情
		goToMore(row) {
			const { href } = this.$router.resolve({
				path: '/roleMain',
				query: {
					rl_id: row.demand_id,
					rl_sn: row.demand_sn,
					task_id: row.id,
					task_sn: row.task_sn,
					start_date: row.start_date
				}
			})
			window.open(href, '_blank')
		},

		// 跳转任务列表
		goToMoreList(row) {
			const { href } = this.$router.resolve({
				path: '/tasklist',
				query: { task_sn: row.task_sn, start: this.ruleForm.date1, end: this.ruleForm.date2 }
			})
			window.open(href, '_blank')
		},

		//店铺的自动完成
		querySearch(queryString, cb) {
			var restaurants = this.shopList
			var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
			// 调用 callback 返回建议列表的数据
			cb(results)
		},
		createFilter(queryString) {
			return restaurant => {
				return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
			}
		},
		handleSelect(item) {
			this.shop_id = item.id
		},

		//分页组件->子组件传值
		onChildValue(item) {
			this.pageNum = item[0]
			this.pageSizeNow = item[1]
			if (this.areaList.length > 0) {
				//上面的列表数据
				this.listShop()
			}
		},

		changeBtndialogtype() {
			let [id, name] = this.type_arr.split('|') // es6 数组解构赋值
			this.label_id = id
			this.label_name = name
		},
		changeBtndialogtype_next() {
			let [id, name] = this.next_type_arr.split('|') // es6 数组解构赋值
			this.next_label_id = id
			this.next_label_name = name
		},
		changeBtndialogarea() {
			this.shearchBtn()
		},

		changeBtndialogarea_next() {
			let [id, name] = this.next_area_arr.split('|') // es6 数组解构赋值
			this.next_area_id = id
			this.next_area_name = name
		},

		//获取商圈
		async getAreaList(city_id) {
			try {
				this.s_time_slot = []
				let ret = await fetchAreaList({
					city_id: city_id,
					agent_id: this.agent_id
				})
				ret.list.forEach(item => {
					item.value = item.area_name
				})
				this.areaList = ret.list
				// 如果本地this.area_arr 存在值，那么不在赋值，如果不存在，赋予相关值
				// if (this.s_time_slot == '' || this.s_time_slot == null) {
				// 	// 默认选中非254-平谷的
				// 	this.areaList.forEach(element => {
				// 		// 平谷
				// 		if (element.area_name != '平谷' && element.area_name != '华成商圈' && element.id != 0) {
				// 			var pusharr = element.id + '|' + element.area_name
				// 			this.s_time_slot.push(pusharr)
				// 		}
				// 	})
				// }
			} catch (error) {
				console.log('error:', error)
			}
		},

		tagstate(e) {
			this.index = e
			this.status = e
			//请求任务列表接口
			this.pageNum = 1
			this.listShop()
		},
		// 任务取消-弹框确认
		async addMenuBtn() {
			if (!this.cancel.reason) {
				this.$message.error('请选择取消原因')
				return
			}
			try {
				let ret = await taskCancel({
					sn: this.sn,
					reason_id: this.cancel.reason, // 取消原因id
					remark: this.cancel.bz // 取消备注
				})
				console.log('任务取消', ret)
				this.$message.success('操作成功')
				this.hiddenRY()
				this.listShop()
			} catch (error) {
				this.hiddenRY()
			}
		},
		// 任务撤回--确认弹框
		async addCxBtn() {
			if (!this.revoke.reason) {
				this.$message.error('请选择撤回原因')
				return
			}
			try {
				let ret = await taskWithdraw({
					sn: this.sn,
					reason_id: this.revoke.reason, // 撤回原因
					remark: this.revoke.bz // 撤回备注
				})
				this.hiddenRY()
				this.$message.success('操作成功')
				this.listShop()
			} catch (error) {
				console.log('任务撤回：', error)
				this.hiddenRY()
			}
		},
		// 修改
		async editBtn(e, index) {
			this.ids = e.id
			this.sn = e.task_sn
			this.index = index
			this.TaskEdit = true //修改任务
			this.diaTitle = '修改任务'
			try {
				let ret = await taskInfo({
					id: this.ids
				})
				this.edit_task_sn = ret.sn
				this.edit_time1 = ret.start_time
				this.edit_time2 = ret.end_time
				this.edit_date = ret.hour_expect //计划时长
				this.edit_hour_actual = ret.hour_actual //实际时长
				this.manual_task_remark = ret.task_description
				if (ret.actual_end_time) {
					this.actual_end_time = ret.actual_end_time
				}
				if (ret.checkin_time == '0000-00-00 00:00:00') {
					this.edit_checkin_time = '' //签到时间
				} else {
					this.edit_checkin_time = ret.checkin_time //签到时间
					// this.edit_checkin_time = ret.actual_start_time //签到时间
				}
				if (ret.actual_start_time) {
					this.actual_start_time = ret.actual_start_time //计费开始时间
					this.actual_start_time2 = ret.actual_start_time //计费开始时间
				}
				this.edit_hour_delay = ret.hour_delay //延长时长
				this.edit_price = ret.checkin_time //价格
				if (ret.actual_end_time == '0000-00-00 00:00:00') {
					this.edit_finish_time = '' //完成时间
				} else {
					this.edit_finish_time = ret.actual_end_time //完成时间
				}
				if (ret.actual_end_time == '0000-00-00 00:00:00') {
					this.edit_finish_time2 = '' //完成时间
				} else {
					this.edit_finish_time2 = ret.actual_end_time //完成时间
				}
				if (this.edit_finish_time == undefined) {
					this.edit_finish_time = ''
				}
				if (this.edit_finish_time2 == undefined) {
					this.edit_finish_time2 = ''
				}
				this.edit_static = ret.status.toString()
				this.edit_static2 = ret.status.toString()
				this.amout_shop = ret.amout_shop
			} catch (error) {
				console.log('error:', error)
			}
		},
		// 任务修改
		async taskBtnEdit() {
			if (!this.update_remark) {
				this.$message.error('请填写备注')
				return
			}

			try {
				let ret = await taskSave({
					id: this.ids,
					sn: this.sn,
					status: this.edit_static, // 任务状态
					// checkin_time: this.edit_checkin_time, // 签到时间
					actual_start_time: this.actual_start_time, // 计费开始时间
					hour_delay: this.edit_hour_delay, // 延时时间
					finish_time: this.edit_finish_time, // 结束时间
					hour_actual: this.edit_hour_actual, // 实际时长
					amout_shop: this.amout_shop, // 价格
					finish_time_origin: this.edit_time2,
					task_description: this.manual_task_remark
						? this.manual_task_remark + ';' + this.update_remark
						: this.update_remark
				})
				this.hiddenRY()
				this.$message.success('操作成功')
				this.listShop()
			} catch (error) {
				console.log('error:', error)
			}
		},

		// 关闭手动签到dialog
		closeTaskSignIn() {
			this.hiddenRY()
		},
		// 关闭手动签退dialog
		closeSignOutDialog() {
			this.hiddenRY()
		},
		//取消
		redactBtn(e, index) {
			this.ids = e.id
			this.sn = e.task_sn
			this.index = index
			this.StateShowStop = true //状态关闭
			this.diaTitle = '取消任务'
		},
		//撤回
		withdraw(e, index) {
			this.ids = e.id
			this.sn = e.task_sn
			this.index = index
			this.StateShowcx = true //状态关闭
			this.diaTitle = '撤销任务'
		},
		//隐藏所有的弹框
		hiddenRY() {
			this.StateShowStop = false
			this.StateShowcx = false
			this.TaskEdit = false
			this.TaskSignIn = false
			this.taskSignOutDialog = false
			this.JobState = false
			this.AssignmentTips = false
			this.recordsList = []
			this.revoke.zrf = '' //责任方清空
			this.revoke.type = '' //类型清空
			this.revoke.reason = '' //原因清空
			this.revoke.bz = '' //备注清空
			this.revoke_type = [] //撤销类型列表清空
			this.revoke_reason = [] //撤销原因列表清空

			this.cancel.zrf = '' //责任方清空
			this.cancel.type = '' //类型清空
			this.cancel.reason = '' //原因清空
			this.cancel.bz = '' //备注清空
			this.cancel_type = [] //取消类型列表清空
			this.cancel_reason = [] //取消原因列表清空

			//修改输入框清空
			this.edit_task_sn = ''
			this.edit_time1 = ''
			this.edit_time2 = ''
			this.edit_date = '' //计划时长
			this.actual_end_time = ''
			this.edit_checkin_time = '' //签到时间
			this.actual_start_time = '' //计费开始时间
			this.actual_start_time2 = '' //计费开始时间
			this.edit_hour_delay = '' //延长时长
			this.edit_price = '' //价格
			this.edit_finish_time = '' //完成时间
			this.edit_finish_time2 = '' //完成时间
			this.edit_hour_actual = ''
			this.edit_static = ''
			this.edit_static2 = ''
			this.amout_shop = ''
			this.manual_checkin_time = ''
			this.manual_remark = ''
			this.manual_task_remark = ''
			this.sign_out_description = ''
			this.update_remark = ''
			this.finish_time = ''
			this.range_time1 = ''
			this.range_time2 = ''

			this.adjustment = {
				adjustment_sn: '', //调账记录编号
				task_sn: '', //任务编号
				dpmc: '', //店铺名称
				sq: '', //商圈
				gw: '', //岗位
				gzsj: '', //工作时间
				dj: '', //店铺单价
				personnel_dj: '', //人才单价
				jdr: '', //接单人
				sjsc: '', //实际时长
				fy: '', //费用
				qdsj: '', //签到时间
				wcsj: '', //完成时间
				zt: '', //状态
				sc: '1', //时长
				sc_next: '0',
				scje: '0', //时长金额
				qtje: '1', //其他金额
				qtje_next: '0',
				hjje: '0', //合计金额
				bz: '', //备注
				personnel_sc: '1', //时长
				personnel_sc_next: '0',
				personnel_scje: '0', //时长金额
				personnel_qtje: '1', //其他金额
				personnel_qtje_next: '0',
				personnel_hjje: '0', //合计金额
				personnel_bz: '', //备注
				is_prepay: '', //是否预付
				invoice_status: '' //发票状态
			}
		},
		// 创建调账单
		async ticketMesaudit(e) {
			if (!this.adjustment.task_sn) {
				this.$message.error('请填写任务编号！')
				return
			}

			// shop
			let shop_obj
			if (this.adjustment.hjje != 0 && this.adjustment.bz) {
				shop_obj = {
					adjust_hours: this.adjustment.sc == 1 ? this.adjustment.sc_next * 1 : this.adjustment.sc_next * -1, //调整时长
					amount_hours: this.adjustment.scje, //时长金额
					amount_other: this.adjustment.qtje == 1 ? this.adjustment.qtje_next * 1 : this.adjustment.qtje_next * -1, //其他金额
					adjust_amount: this.adjustment.hjje, //合计金额
					remark: this.adjustment.bz //备注
				}
			} else if (this.adjustment.hjje == 0 && !this.adjustment.bz) {
				shop_obj = {}
			} else {
				this.$message.error('信息填写有误！')
				return
			}

			// staff
			let staff_obj
			if (this.adjustment.personnel_hjje != 0 && this.adjustment.personnel_bz) {
				staff_obj = {
					adjust_hours:
						this.adjustment.personnel_sc == 1
							? this.adjustment.personnel_sc_next * 1
							: this.adjustment.personnel_sc_next * -1, //调整时长
					amount_hours: this.adjustment.personnel_scje, //时长金额
					amount_other:
						this.adjustment.personnel_qtje == 1
							? this.adjustment.personnel_qtje_next * 1
							: this.adjustment.personnel_qtje_next * -1, //其他金额
					adjust_amount: this.adjustment.personnel_hjje, //合计金额
					remark: this.adjustment.personnel_bz //备注
				}
			} else if (this.adjustment.personnel_hjje == 0 && !this.adjustment.personnel_bz) {
				staff_obj = {}
			} else {
				this.$message.error('信息填写有误！')
				return
			}

			if (
				this.adjustment.hjje == 0 &&
				!this.adjustment.bz &&
				this.adjustment.personnel_hjje == 0 &&
				!this.adjustment.personnel_bz
			) {
				this.$message.error('信息填写有误！')
				return
			}

			// 是否是预付&&已开票&&负的调账，
			let isPrepay = this.adjustment.is_prepay
			let invoice_status = this.adjustment.invoice_status
			if (invoice_status == 50 && isPrepay == 1 && (+this.adjustment.hjje < 0 || +this.adjustment.personnel_hjje < 0)) {
				let ret = await this.$alert('该任务已开发票，不允许创建退款调账', '提示', {
					confirmButtonText: '确定'
				})
				if (ret === 'confirm') return
			}

			let adjust = {
				task_sn: this.adjustment.task_sn,
				shop: JSON.stringify(shop_obj),
				staff: JSON.stringify(staff_obj)
			}

			if (e == 2) {
				adjust = {
					...adjust,
					force: 1
				}
			} else {
				let ret = await this.$confirm('确定要创建此调账吗？', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				})
				if (ret === 'cancel') return
			}

			try {
				let ret = await billCreate(adjust)
				// console.log(ret)
				if (+ret.code === 601) {
					//强制确认的弹框出现
					this.AssignmentTips = true
					return
				}
				this.$message.success('创建调账单成功！')
				this.hiddenRY()
				this.listShop()
			} catch (err) {}
		},
		// 调账账单列表
		async getAdjustmentList() {
			try {
				let ret = await billList({
					task_sn: this.adjustment.task_sn
				})
				if (ret.list) {
					this.recordsList = ret.list
				} else {
					this.recordsList = []
				}
			} catch (err) {
				console.log('error:', err)
			}
		},

		// 签到弹框
		async signIn(e, index) {
			this.ids = e.id
			this.sn = e.task_sn
			this.index = index
			this.TaskSignIn = true
			this.diaTitle = '手动签到'
			try {
				let ret = await taskInfo({
					id: this.ids
				})
				this.edit_task_sn = ret.sn
				this.edit_time1 = ret.start_time
				this.edit_time2 = ret.end_time
				this.edit_date = ret.hour_expect //计划时长
				this.manual_task_remark = ret.task_description // 任务备注manual_task_remark

				if (ret.checkin_time == '0000-00-00 00:00:00') {
					this.edit_checkin_time = '' // 签到时间
				} else {
					this.edit_checkin_time = ret.checkin_time
				}
			} catch (error) {
				console.log('error:', error)
			}
		},
		// 确定手动签到
		async taskBtnManual() {
			if (!this.manual_checkin_time) {
				this.$message.error('签到时间不为空')
				return
			}
			if (!this.manual_remark) {
				this.$message.error('备注不能为空')
				return
			}

			try {
				let ret = await taskCheckin({
					sn: this.sn,
					checkin_time: this.manual_checkin_time,
					task_description: this.manual_task_remark
						? this.manual_task_remark + ';' + this.manual_remark
						: this.manual_remark // 任务备注+签到备注
				})
				this.$message.success('操作成功')
				this.listShop()
				this.hiddenRY()
			} catch (error) {
				console.log('error:', error)
				this.hiddenRY()
			}
		},
		abelEadit() {
			if (this.edit_static == '50' && this.edit_static2 != '50') {
				this.edit_finish_time = this.date_now()
			} else {
				this.edit_finish_time = this.edit_finish_time2
			}
			//完成时间改变
			this.edit_finish_time_change()
		},
		//实际时长的计算
		difference(a, b) {
			console.log(a + '开始时间')
			console.log(b + '完成时间')
			var checkin_time_times = new Date(a).getTime()
			var finish_time_times = new Date(b).getTime()
			var endtimes = finish_time_times - checkin_time_times
			console.log(endtimes + '时间差')
			if (endtimes <= 0) {
				this.edit_hour_actual = 0
			} else {
				// 总秒数
				var second = Math.floor(endtimes / 1000)
				// console.log('second', second)
				var hour = second / 3600
				// 小时
				// console.log('hour', hour)
				hour = Math.round(hour * 100) / 100
				var hr = hour.toFixed(2)
				if (window.isNaN(hr) == true) {
					hr = 0
				}
				console.log(hr + '时间差（小时）')
				this.edit_hour_actual = hr
			}
		},
		//跳转人才画像
		toPersonnelListHx(row) {
			const { href } = this.$router.resolve({ path: '/personnelListHx', query: { id: row.staff_id } })
			window.open(href, '_blank')
		},
		//跳转任务列表
		toTasklist(row) {
			const { href } = this.$router.resolve({ path: '/tasklist', query: { name: row.name } })
			window.open(href, '_blank')
		},
		//签到时间改变
		edit_checkin_time_change() {
			if (this.edit_checkin_time != '') {
				if (this.actual_start_time2 == '0000-00-00 00:00:00') {
					console.log('?1')
					//实际结束时间-实际开始时间
					this.actual_start_time = this.edit_checkin_time //赋值于计费开始时间
					this.difference(this.actual_start_time, this.actual_end_time)
				} else {
					console.log('?2')
					//签到时间-任务开始时间>5的时候，则赋值
					var cha = this.time_dis(this.edit_time1, this.edit_checkin_time)
					console.log(cha)
					if (cha >= 5) {
						console.log('?3')
						this.actual_start_time = this.edit_checkin_time //赋值于计费开始时间
					} else {
						this.actual_start_time = this.edit_time1 //赋值于计费开始时间
					}
					//实际结束时间-实际开始时间
					this.difference(this.actual_start_time, this.actual_end_time)
				}
			}
		},
		//完成时间改变
		edit_finish_time_change() {
			if (this.edit_finish_time != '') {
				this.actual_end_time = this.edit_finish_time
				this.difference(this.actual_start_time, this.actual_end_time)
			}
		},

		// 点击签退，查询任务详情显示
		async signOut(e, index) {
			let id = e.id
			this.index = index
			this.taskSignOutDialog = true
			this.diaTitle = '手动签退'
			try {
				let ret = await taskInfo({
					id: id
				})
				console.log('签退任务详情', ret)
				this.edit_task_sn = ret.sn
				this.staff_sn = ret.staff_sn
				this.edit_time1 = ret.start_time
				this.edit_time2 = ret.end_time
				this.edit_date = ret.hour_expect //计划时长
				this.manual_checkin_time = ret.actual_start_time
				this.manual_task_remark = ret.task_description
			} catch (error) {
				console.log('error:', error)
			}
		},
		adjustBill(info, index) {
			// console.log('info: ', info)
			// console.log('index: ', index)
			this.JobState = true
			this.adjustment.task_sn = info.task_sn
			this.getTaskInfo()
		},
		// 获取任务详情
		async getTaskInfo() {
			try {
				let ret = await taskInfo({
					sn: this.adjustment.task_sn
				})
				console.log(ret)
				this.adjustment.dpmc = ret.shop_name //店铺名称
				this.adjustment.sq = ret.area_name //商圈
				this.adjustment.gw = ret.job_name //岗位
				this.adjustment.gzsj = ret.start_time.substr(11, 5) + ' - ' + ret.end_time.substr(11, 5) //工作时间
				this.adjustment.dj = this.moneyUnitCent2Coin(ret.amout_shop) //店铺单价
				this.adjustment.personnel_dj = this.moneyUnitCent2Coin(ret.amout_staff) //人才单价
				this.adjustment.jdr = ret.staff_name //接单人
				this.adjustment.sjsc = ret.hour_actual + 'h' //实际时长
				this.adjustment.fy = this.moneyUnitCent2Coin(ret.total_shop) + '元' //费用
				this.adjustment.qdsj = ret.checkin_time //签到时间
				this.adjustment.wcsj = ret.finish_time //完成时间
				this.adjustment.zt = ret.status_name //状态
				this.adjustment.is_prepay = ret.is_prepay //状态
				this.adjustment.invoice_status = ret.invoice_status //状态
				this.getAdjustmentList()
			} catch (err) {
				console.log('error:', err)
			}
		},

		// 确认签退
		async taskBtnManualSignOut() {
			if (!this.finish_time) {
				this.$message.error('签退时间不能为空')
				return
			}
			if (!this.sign_out_description) {
				this.$message.error('备注不能为空')
				return
			}

			try {
				// 签退接口
				let ret = await taskCheckOut({
					sn: this.edit_task_sn,
					staff_sn: this.staff_sn,
					finish_time: this.finish_time,
					task_description: this.manual_task_remark
						? this.manual_task_remark + ';' + this.sign_out_description
						: this.sign_out_description
				})
				console.log('任务签退:', ret)
				this.$message.success('操作成功')
				this.listShop()
				this.hiddenRY()
			} catch (error) {
				console.log('error:', error)
			}
		},
		//全选-取消全选商圈
		selectAllArea() {
			let arr = []
			this.areaList.forEach(item => {
				arr.push(`${item.id}|${item.area_name}`)
			})
			if (this.areaStatus == true) {
				this.s_time_slot = arr
			} else {
				this.s_time_slot = []
			}
			this.areaStatus = !this.areaStatus
			// this.shearchBtn()
		},
		async setValue(arrVal) {
			// console.log('agent_id', item)
			// this.query.agent_id = item
			this.agent_id = arrVal.agent_id
			this.cityList = arrVal.city_list
			this.city_id = this.cityList[0].id
			this.city_val = this.cityList[0].name
			await this.getshopList()
			await this.getAreaList(this.city_id) //商圈列表
		}
	}
}
</script>

<style scoped>
@import '../../assets/style/abnormal.css';
</style>



// WEBPACK FOOTER //
// src/components/abnormal/TaskAttendances.vue